package com.jihu.design.structural.proxy.dynamic;

import java.util.Arrays;

/**
 * 动态代理模式
 * JDK要求被代理对象必须有接口
 * @author jihu
 * @date 2021/9/23
 */
public class MainTest {

    public static void main(String[] args) {
       ManTikTok manTikTok  = JdkTikTokProxy.getProxy(new HugeTikTok());

       manTikTok.tiktok();

       ((SellTikTok) manTikTok).sell();

       //proxy 只能转成接口类
//       ((HugeTikTok) manTikTok).test();
        System.out.println(Arrays.asList(manTikTok.getClass().getInterfaces()));
    }
}
